//
//  LLContactModel.m
//  LLWeChat
//
//  Created by GYJZH on 9/9/16.
//  Copyright © 2016 GYJZH. All rights reserved.
//

#import "LLContactModel.h"

@implementation LLContactModel

- (instancetype)initWithBuddy:(NSString *)buddy {
    self = [super init];
    if (self) {
        _userName = buddy;
        if (_userName.length == 0)
            return nil;
        
        //转成了可变字符串
        NSMutableString *str = [NSMutableString stringWithString:_userName];
        //先转换为带声调的拼音
        CFStringTransform((CFMutableStringRef)str,NULL, kCFStringTransformMandarinLatin,NO);
        //再转换为不带声调的拼音
        CFStringTransform((CFMutableStringRef)str,NULL, kCFStringTransformStripDiacritics,NO);
        //转化为大写拼音
        _pinyinOfUserName = [str capitalizedString];
        _nickname = @"";
//        _avatarImage = [UIImage imageNamed:@"icon_avatar"];
    }
    
    return self;
}

@end
